package jjn.acwing.algorithm_basic.chapter1.big_number;

import java.util.*;

/**
 * @author Jiang Jining
 * @since 2023-09-17 18:58
 */
public class Acwing793 {
    
    static Deque<Integer> multiply(List<Integer> nums, int b) {
        Deque<Integer> result = new ArrayDeque<>();
        int t = 0;
        for (int i = 0; i < nums.size() || t != 0; i++) {
            if (i < nums.size()) {
                t += nums.get(i) * b;
            }
            result.offer(t % 10);
            t = t / 10;
        }
        while (result.size() > 1 && Objects.equals(result.peekLast(), 0)) {
            result.pollLast();
        }
        return result;
    }
    
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String a = scanner.next();
        int b = scanner.nextInt();
        List<Integer> nums = new ArrayList<>();
        for (int i = 0; i < a.length(); i++) {
            nums.add(a.charAt(a.length() - 1 - i) - '0');
        }
        Deque<Integer> deque = multiply(nums, b);
        while (!deque.isEmpty()) {
            System.out.print(deque.pollLast());
        }
        System.out.println();
    }
}
